import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

import '../theme/app_theme.dart';
import 'widget/header_item_title.dart';
import 'widget/manhua_list_item.dart';

class FreeScreen extends StatefulWidget {
  const FreeScreen({super.key});

  @override
  State<FreeScreen> createState() => _FreeScreenState();
}

class _FreeScreenState extends State<FreeScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color(0xFF211839),
      appBar: AppBar(
        title: const Text('Free'),
        centerTitle: false,
        leading: IconButton(
          icon: const Icon(Icons.arrow_back, color: Colors.white),
          onPressed: () => Navigator.of(context).pop(),
        ),
      ),
      body: SafeArea(
          child: SingleChildScrollView(
        child: Column(
          children: [
            HeaderItemTitle(
              title: "News",
              onTap: () {
                GoRouter.of(context).pushNamed('manhua_list',
                    pathParameters: {'category': 'News'});
              },
            ),
            ManhListItem(),
            const SizedBox(height: 12),
            ManhListItem(),
            const SizedBox(height: 12),
            ManhListItem(),
            SizedBox(
              height: 16,
            ),
            HeaderItemTitle(
              title: "Romantic",
              onTap: () {
                GoRouter.of(context).pushNamed('manhua_list',
                    pathParameters: {'category': 'Romantic'});
              },
            ),
            ManhListItem(),
            const SizedBox(height: 12),
            ManhListItem(),
            const SizedBox(height: 12),
            ManhListItem(),
            SizedBox(
              height: 16,
            ),
            HeaderItemTitle(
              title: "Passionate",
              onTap: () {
                GoRouter.of(context).pushNamed('manhua_list',
                    pathParameters: {'category': 'Passionate'});
              },
            ),
            ManhListItem(),
            const SizedBox(height: 12),
            ManhListItem(),
            const SizedBox(height: 12),
            ManhListItem(),
          ],
        ),
      )),
    );
  }

  // Widget _categoryItem(String title, VoidCallback onTap) {
  //   return GestureDetector(
  //     onTap: onTap,
  //     child: Container(
  //       padding: const EdgeInsets.symmetric(horizontal: 16),
  //       height: 50,
  //       child: Row(
  //         crossAxisAlignment: CrossAxisAlignment.center,
  //         mainAxisAlignment: MainAxisAlignment.spaceBetween,
  //         children: [
  //           Text(
  //             title,
  //             style: const TextStyle(
  //                 color: Colors.white,
  //                 fontSize: 15,
  //                 fontWeight: FontWeight.w500),
  //           ),
  //           const Spacer(),
  //           const Text(
  //             "More",
  //             style: TextStyle(color: Colors.white70, fontSize: 13),
  //           ),
  //           const Icon(
  //             Icons.chevron_right,
  //             color: Colors.white70,
  //           )
  //         ],
  //       ),
  //     ),
  //   );
  // }
}
